<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>缓动效果</title>
    <link rel="stylesheet" href="../public.css">
    <style>
        .box {
            width: 80%;
            margin: auto;
        }

        @keyframes bounce {

            60%,
            80%,
            to {
                transform: translateY(350px);
                animation-timing-function: ease-out;
            }

            70% {
                transform: translateY(250px);
            }

            90% {
                transform: translateY(300px);
            }
        }

        .ball {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: red;
            animation: bounce 3s ease-in;
        }

        .back {
            display: inline-block;
            height: 360px;
            margin-right: 20px;
            border: 2px solid yellowgreen;
        }

        .callout {
            display: block;
            width: 300px;
            padding: 20px;
            background: yellowgreen;
        }

        .back2 input:not(:focus)+.callout {
            transform: scale(0);
        }

        .back2 .callout {
            transition: .5s transform;
            transform-origin: 1.4em -.4em;
        }
        @keyframes elastic-grow {
            from{transform: scale(0);}
            70%{
                transform: scale(1.1);
                animation-timing-function: cubic-bezier(.1,.25,1,.25);
            }
        }
        .back3 input:not(:focus) + .callout{
            transform: scale(0);
            transition-timing-function: ease; 
        }
        .back3 input:focus +.callout{
            animation: elastic-grow .5s;
        }
        .back3 .callout{
            transform-origin: 1.4em -.4em;
            transition: .5s cubic-bezier(.25,.1,.3,1.5);
        }
    </style>
</head>

<body>
    <div class="content">
        <h1></h1>
        <div class="box">
            <div class="back">
                <div class="ball"></div>
            </div>
            <div class="back">
                <div class="ball"></div>
            </div>
            <div class="back">
                <div class="ball"></div>
            </div>
        </div>
        <h1>弹性过度</h1>
        <ul>
            <li>transform: scale(0);需要作用在块状元素上</li>
        </ul>
        <div class="box  back2">
            <label>
                Your username: <input id="username" />
                <span class="callout">Only letters, numbers,
                    underscores (_) and hyphens (-) allowed!</span>
            </label>
        </div>
        <div class="box  back3">
            <label>
                Your username: <input id="username" />
                <span class="callout">Only letters, numbers,
                    underscores (_) and hyphens (-) allowed!</span>
            </label>
        </div>
    </div>

</body>

</html>